package com.hyper_yang._03_designpatterns.principles.demo3.before;

/**
 * projectName: com.hyper_yang._03_designpatterns.principles.demo3.before
 *
 * @author: sakiko
 * time: 2025/9/26 20:20
 * description: 依赖倒转原则: 高层模块不应该依赖底层模块，两者都应该依赖其抽象; 抽象不应该依赖细节，细节应该依赖抽象。
 * 【面向接口编程，而不是面向实现类】
 */
public class Test {
    public static void main(String[] args) {
        // 获取硬件组件
        XiJieHardDisk hardDisk = new XiJieHardDisk();
        IntelCpu cpu = new IntelCpu();
        KingstonMemory memory = new KingstonMemory();
        // 创建计算机对象
        Computer c = new Computer();
        c.setHardDisk(hardDisk);
        c.setCpu(cpu);
        c.setMemory(memory);
        // 运行
        c.run();
    }
}
